import React from 'react';
import { Descriptions } from 'antd';

export default class FuelCellTab extends React.Component<any, any> {
  componentWillUnmount = () => {
    this.setState = (state, callback) => {
      return;
    };
  };
  render() {
    const { fuelCellVo2 } = this.props;
    let fuelCellVo = fuelCellVo2 || {};
    // 遍历探针温度数组
    const temperatureProbeList = () => {
      if (fuelCellVo.temperatureProbeList) {
        const temperatureProbeList2 = fuelCellVo.temperatureProbeList.map(
          (item: any, index: any) => {
            return (
              <Descriptions.Item
                label={`探针温度值 ${index + 1}`}
                key={index}
              >{`${item} ℃`}</Descriptions.Item>
            );
          },
        );

        return temperatureProbeList2;
      }
      return;
    };
    return (
      <>
        <Descriptions bordered size="small">
          <Descriptions.Item label="燃料电池电压(V)">
            {fuelCellVo.batteryVoltage ? `${fuelCellVo.batteryVoltage}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="燃料电池电流(A)">
            {fuelCellVo.batteryCurrent ? `${fuelCellVo.batteryCurrent}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="燃料消耗率(kg/100km)">
            {fuelCellVo.consumptionRate ? `${fuelCellVo.consumptionRate}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="氢系统中最高温度(℃)">
            {fuelCellVo.maxTemperature ? `${fuelCellVo.maxTemperature}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="氢系统中最高温度探针代号">
            {fuelCellVo.maxTemperatureSeq}
          </Descriptions.Item>
          <Descriptions.Item label="氢气最高浓度(mg/kg)">
            {fuelCellVo.maxConcentration ? `${fuelCellVo.maxConcentration}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="氢气最高浓度传感器代号">
            {fuelCellVo.maxConcentrationSeq}
          </Descriptions.Item>
          <Descriptions.Item label="氢气最高压力(MPa)">
            {fuelCellVo.maxPressure ? `${fuelCellVo.maxPressure}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="氢气最高压力传感器代号">
            {fuelCellVo.maxPressureSeq}
          </Descriptions.Item>
          <Descriptions.Item label="高压 DC/DC状态" span={3}>
            {fuelCellVo.maxDCStatus === '1' ? '工作' : fuelCellVo.maxDCStatus === '2' ? '断开' : ''}
          </Descriptions.Item>
          <Descriptions.Item label="燃料电池温度探针总数" span={3}>
            {fuelCellVo.temperatureProbeTotal}
          </Descriptions.Item>

          {temperatureProbeList()}
        </Descriptions>
      </>
    );
  }
}
